package com.itany.life.sessionredis2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
public class RedisController {

    @Autowired
    private RedisTemplate redisTemplate;

    @RequestMapping("/f2")
    public void f2(HttpSession session){
        System.out.println("RadisController.f2()");

        String a= (String) session.getAttribute("a");

        System.out.println("a = " + a);

        String b= (String) redisTemplate.opsForValue().get("b");

        System.out.println("b = " + b);
    }
}
